#ifndef QTCARDGROUP_H
#define QTCARDGROUP_H

#include <QWidget>
#include <QGridLayout>
#include "CardGroup.h"
#include "QtCard.h"
#include <list>

class QtCardGroup : public QWidget
{
	Q_OBJECT

public:
	QtCardGroup(QWidget *parent = 0, Qt::WFlags flags = 0);
	~QtCardGroup();
	void SetCardGroup(const CardGroup& group);

	void SetColumnSize(unsigned int size);

	
	void AddCard(const Card& card);
	void RemoveCard(unsigned int index);
	void SetSize(unsigned int size);
	bool Full() const;
	QtCard* GetCard(unsigned int index);

signals:
	void ClickedCard(QtCardGroup* group, unsigned int index);

public slots:
	void OnCardClicked(QtCard* card);


private:
	void Clear();
	bool Find(QtCard* card, unsigned int* index) const;
	unsigned int FirstEmptySlot() const;

	QGridLayout *layout;
	std::vector<QtCard*> cards;
	unsigned int columnSize;
};

#endif // QTCARDGROUP_H
